package schema

// RootNode 根节点
const RootNode = 0

const KeyAuthTokenUserId = "KeyAuthTokenUserId"

const TokenKey = "Authorization"

const TrackKey = "X-Request-Id"

const TrackTime = "X-Request-Time"

const (
	StatusDelete  = -1
	StatusDefault = 0
)

const (
	Enabled = 0
	Disable = -1
	Destroy = -10
)

const (
	// AircraftStateKey 飞机状态对应字典code
	AircraftStateKey = "aircraft_state"
	// AircraftFaultKey 飞机故障对应的字典key
	AircraftFaultKey = "fault"
	// AircraftNormalKey 飞机正常对应的字典key
	AircraftNormalKey = "normal"
	// AircraftFactoryKey 飞机返厂对应的字典key
	AircraftFactoryKey = "return_factory"
)

const (
	// FlightTaskCancel 任务取消
	FlightTaskCancel = 10
	// FlightTaskBreakCancel 故障取消，需要更新飞机的状态
	FlightTaskBreakCancel = 11
	// FlightTaskInvalid 计划时间30min内未执行，认为已失效
	FlightTaskInvalid = 12
	// FlightTaskExecuting 任务进行中
	FlightTaskExecuting = 2
	// FlightTaskFinish 任务完成
	FlightTaskFinish = 1
)

const (
	// AircraftIdle 飞机空闲中
	AircraftIdle = 0
	// AircraftInFlight 飞机正在飞行中
	AircraftInFlight = 1
	// AircraftTaskWait 飞机有计划任务未执行，已排班
	AircraftTaskWait = 2
	// AircraftTaskFinish 飞机任务已完成
	AircraftTaskFinish = 3
)

const (
	// LifetimeTypeBody 机体A检
	LifetimeTypeBody = 1
	// LifetimeTypeEngine 发动机维护
	LifetimeTypeEngine = 2
	// LifetimeTypeLanding 起落架
	LifetimeTypeLanding = 3
	// LifetimeTypeAPU APU
	LifetimeTypeAPU = 4
	// LifetimeTypeHydraulic 液压软管
	LifetimeTypeHydraulic = 5
)

var MaintenanceMap = map[int]string{
	LifetimeTypeBody:      "机体A检",
	LifetimeTypeEngine:    "发动机维护",
	LifetimeTypeLanding:   "起落架",
	LifetimeTypeAPU:       "APU",
	LifetimeTypeHydraulic: "液压软管",
}

const (
	// AdjustTypeTask 调整类型-任务累加
	AdjustTypeTask = 1
	// AdjustTypeCorrection 调整类型-校正
	AdjustTypeCorrection = 2
	// AdjustTypeOther 调整类型-其他
	AdjustTypeOther = 3
	// AdjustTypeInit 初始添加
	AdjustTypeInit = 10
)

var AdjustMap = map[int]string{
	AdjustTypeTask:       "任务累加",
	AdjustTypeCorrection: "校正",
	AdjustTypeOther:      "其他",
	AdjustTypeInit:       "初始添加",
}

const (
	// BodyIntervalDuration 机体A检间隔运行时长：秒
	BodyIntervalDuration = 330 * 60 * 60
	// BodyIntervalCount 机体A检间隔运行起落次数：次
	BodyIntervalCount = 165
)

const (
	// ComponentEngine1 组件类型 - 发动机1
	ComponentEngine1 = 1
	// ComponentEngine2 组件类型 - 发动机2
	ComponentEngine2 = 2
	// ComponentEngine3 组件类型 - 发动机3
	ComponentEngine3 = 3
	// ComponentEngine4 组件类型 - 发动机4
	ComponentEngine4 = 4
	// ComponentAirframe 组件类型 - 机体
	ComponentAirframe = 5
	//ComponentLanding 起落架
	ComponentLanding = 6
	//ComponentAPU APU
	ComponentAPU = 7
	//ComponentHydraulic1 液压软管1
	ComponentHydraulic1 = 8
	//ComponentHydraulic2 液压软管2
	ComponentHydraulic2 = 9
)

var ComponentMap = map[int]string{
	ComponentEngine1:    "发动机1",
	ComponentEngine2:    "发动机2",
	ComponentEngine3:    "发动机3",
	ComponentEngine4:    "发动机4",
	ComponentAirframe:   "机体",
	ComponentLanding:    "起落架",
	ComponentAPU:        "APU",
	ComponentHydraulic1: "液压软管1",
	ComponentHydraulic2: "液压软管2",
}

// ComponentMaintenanceMap 组件类型映射维护类型
var ComponentMaintenanceMap = map[int]int{
	ComponentEngine1:    LifetimeTypeEngine,
	ComponentEngine2:    LifetimeTypeEngine,
	ComponentEngine3:    LifetimeTypeEngine,
	ComponentEngine4:    LifetimeTypeEngine,
	ComponentAirframe:   LifetimeTypeBody,
	ComponentLanding:    LifetimeTypeLanding,
	ComponentAPU:        LifetimeTypeAPU,
	ComponentHydraulic1: LifetimeTypeHydraulic,
	ComponentHydraulic2: LifetimeTypeHydraulic,
}

const (
	// LocationTypeNormal 普通机位
	LocationTypeNormal = 1
	// LocationTypeRepair 修理厂
	LocationTypeRepair = 2
)
